#pragma comment (lib,"pnglib.lib")

#include "libs/PNGlib.h"


namespace TexSpace
{
	//BMP
	struct bmp_file_header_t;
	struct bmp_info_header_t;
	struct bmp_core_header_t;
	struct bmp_core_info_t;

	enum os_type_e;

	void ReadBMP1bit(FILE *fp, const GLubyte *colormap,enum os_type_e os_type, image_src *texinfo);
	void ReadBMP4bits(FILE *fp, const GLubyte *colormap,enum os_type_e os_type, image_src *texinfo);
	void ReadBMP8bits (FILE *fp, const GLubyte *colormap,enum os_type_e os_type,image_src *texinfo);
	void ReadBMP24bits (FILE *fp, image_src *texinfo);
	void ReadBMP32bits (FILE *fp, image_src *texinfo);
	void ReadBMP8bitsRLE (FILE *fp, const GLubyte *colormap,image_src *texinfo);
	void ReadBMP4bitsRLE (FILE *fp, const GLubyte *colormap,image_src *texinfo);

	image_src * ReadBMPFile (const char *filename);


	//DDS
	struct DDPixelFormat;
	struct DDSCaps;
	struct DDColorKey;
	struct DDSurfaceDesc;

	image_src * ReadDDSFile (const char *filename);


	//JPG
	image_src * ReadJPEGFile (const char *filename);

	//PNG
	void GetPNGtextureInfo (int color_type, image_src *texinfo);
	image_src * ReadPNGFile (const char *filename);

	//PCX
	struct pcx_header_t;
	void ReadPCX1bit (FILE *fp, const struct pcx_header_t *hdr, image_src *texinfo);
	void ReadPCX4bits (FILE *fp, const struct pcx_header_t *hdr, image_src *texinfo);
	void ReadPCX8bits (FILE *fp, const struct pcx_header_t *hdr, image_src *texinfo);
	void ReadPCX24bits (FILE *fp, const struct pcx_header_t *hdr, image_src *texinfo);
	image_src * ReadPCXFile (const char *filename);

	//TGA
	struct tga_header_t;
	void GetTextureInfo (const struct tga_header_t *header, image_src *texinfo);
	void ReadTGA8bits (FILE *fp, const GLubyte *colormap, image_src *texinfo);
	void ReadTGA16bits (FILE *fp, image_src *texinfo);
	void ReadTGA24bits (FILE *fp, image_src *texinfo);
	void ReadTGA32bits (FILE *fp, image_src *texinfo);
	void ReadTGAgray8bits (FILE *fp, image_src *texinfo);
	void ReadTGAgray16bits (FILE *fp, image_src *texinfo);
	void ReadTGA8bitsRLE (FILE *fp, const GLubyte *colormap,image_src *texinfo);
	void ReadTGA16bitsRLE (FILE *fp, image_src *texinfo);
	void ReadTGA24bitsRLE (FILE *fp,image_src *texinfo);
	void ReadTGA32bitsRLE (FILE *fp, image_src *texinfo);
	void ReadTGAgray8bitsRLE (FILE *fp, image_src *texinfo);
	void ReadTGAgray16bitsRLE (FILE *fp, image_src *texinfo);

	image_src * ReadTGAFile (const char *filename);

	PNGINFO	pngInfo;
	void InitPNGLoader();
	void DeInitPNGLoader();

	image_src * ReadPNGFile(const char *filename);
};

#include "texformats/bmp.h"
#include "texformats/dds.h"
#include "texformats/jpg.h"
#include "texformats/pcx.h"
#include "texformats/png.h"
#include "texformats/tga.h"